var verify_equal_city_but_not_equal_current_price = JSON.parse('{"CODE":0, "ACTION":"","LEVEL":"T1", "MSG":"","DATA":"","SCRIPTNAME":"verify_equal_city_but_not_equal_current_price"}');

if (!isNull(retail_tax) && !isNull(retail_end_date) && !isNull(trait_nbr)) {
    var itemStoreJsonList = JSON.parse(item_store_json);
    var verify_equal_city_but_not_equal_current_price_amount_list = []
    var verify_equal_city_but_not_equal_current_price_amount_city_list = []
    if (trait_nbr == 'ALL') {
        var store_trait_list_map = new Map();
        if (!isNull(trait_store)) {
            trait_store.keys().forEach(function (k) {
                if (!isNull(trait_store.valuesByKey(k))) {
                    trait_store.valuesByKey(k)[0].forEach(function (v) {
                        store_trait_list_map.put(v, k);
                    })
                }
            })
        }

        var trait_price_reatail_list_map = new Map();
        itemStoreJsonList.forEach(function (itemStoreJson) {
            if (!isNull(itemStoreJson.price_action_pc_retail)) {
                if (store_trait_list_map.containsKey(itemStoreJson.store_id)) {
                    if (trait_price_reatail_list_map.containsKey(store_trait_list_map.get(itemStoreJson.store_id))) {
                        var price_action_pc_retail_val_list = trait_price_reatail_list_map.get(store_trait_list_map.get(itemStoreJson.store_id));
                        price_action_pc_retail_val_list.push(parseFloat(itemStoreJson.price_action_pc_retail));
                        trait_price_reatail_list_map.removeByKey(store_trait_list_map.get(itemStoreJson.store_id))
                        trait_price_reatail_list_map.put(store_trait_list_map.get(itemStoreJson.store_id), price_action_pc_retail_val_list)
                    } else {
                        trait_price_reatail_list_map.put(store_trait_list_map.get(itemStoreJson.store_id), [parseFloat(itemStoreJson.price_action_pc_retail)])
                    }
                }
            }
        })
    } else {
        itemStoreJsonList.forEach(function (itemStoreJson) {
            if (!isNull(trait_store) && trait_store.containsKey(trait_nbr)) {
                var clubList = trait_store.get(trait_nbr)
                if (!isNull(clubList)) {
                    clubList.forEach(function (club) {
                        if (club == itemStoreJson.store_id) {
                            if (!isNull(itemStoreJson.price_action_pc_retail)) {
                                verify_equal_city_but_not_equal_current_price_amount_list.push(trait_nbr + '-' + parseFloat(itemStoreJson.price_action_pc_retail));
                            }
                        }
                    })
                }
            }
        })
    }

    var verify_equal_city_but_not_equal_current_price_amount_set1 = []
    if (verify_equal_city_but_not_equal_current_price_amount_list.length > 1) {
        verify_equal_city_but_not_equal_current_price_amount_list.forEach(function (kkk) {
            if (verify_equal_city_but_not_equal_current_price_amount_set1.indexOf(kkk) == -1) {
                verify_equal_city_but_not_equal_current_price_amount_set1.push(kkk);
            }
        })
    }
    // verify_equal_city_but_not_equal_current_price.CODE = 2;
    // verify_equal_city_but_not_equal_current_price.ACTION = 'error';
    // verify_equal_city_but_not_equal_current_price.MSG = '----------商品存在同城不同原价，不可填写结束日期----------' + JSON.stringify(trait_price_reatail_list_map);

    var verify_equal_city_but_not_equal_current_price_amount_flag = false;
    if (!isNull(trait_price_reatail_list_map)) {
        trait_price_reatail_list_map.keys().forEach(function (k) {
            var verify_equal_city_but_not_equal_current_price_amount_set2 = []
            if (!isNull(trait_price_reatail_list_map.valuesByKey(k))) {
                trait_price_reatail_list_map.valuesByKey(k)[0].forEach(function (v) {
                    if (verify_equal_city_but_not_equal_current_price_amount_set2.indexOf(k + '-' + v) == -1) {
                        verify_equal_city_but_not_equal_current_price_amount_set2.push(k + '-' + v);
                    }
                })
            }
            if (verify_equal_city_but_not_equal_current_price_amount_set2.length > 1) {
                verify_equal_city_but_not_equal_current_price_amount_flag = true
                verify_equal_city_but_not_equal_current_price_amount_set2.forEach(function (kk) {
                    if (trait_city_name_map.containsKey(kk.split('-')[0])) {
                        verify_equal_city_but_not_equal_current_price_amount_city_list.push(trait_city_name_map.get(kk.split('-')[0]))
                    }
                })
            }
        })
    }
    if (verify_equal_city_but_not_equal_current_price_amount_set1.length > 1) {
        verify_equal_city_but_not_equal_current_price_amount_set1.forEach(function (ve) {
            if (trait_city_name_map.containsKey(ve.split('-')[0])) {
                verify_equal_city_but_not_equal_current_price_amount_city_list.push(trait_city_name_map.get(ve.split('-')[0]))
            }
        })
        verify_equal_city_but_not_equal_current_price_amount_city_list = listToUnique(verify_equal_city_but_not_equal_current_price_amount_city_list);
        verify_equal_city_but_not_equal_current_price.CODE = 2;
        verify_equal_city_but_not_equal_current_price.ACTION = 'error';
        verify_equal_city_but_not_equal_current_price.MSG = '商品存在同城不同原价，不可填写结束日期,不同原价城市：[' + verify_equal_city_but_not_equal_current_price_amount_city_list.join(',') + ']';
    }

    if (verify_equal_city_but_not_equal_current_price_amount_flag) {
        verify_equal_city_but_not_equal_current_price.CODE = 2;
        verify_equal_city_but_not_equal_current_price.ACTION = 'error';
        verify_equal_city_but_not_equal_current_price_amount_city_list = listToUnique(verify_equal_city_but_not_equal_current_price_amount_city_list);
        verify_equal_city_but_not_equal_current_price.MSG = '商品存在同城不同原价，不可填写结束日期,不同原价城市：[' + verify_equal_city_but_not_equal_current_price_amount_city_list.join(',') + ']';
    }
}
JSON.stringify(verify_equal_city_but_not_equal_current_price);